<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        // indexOf返回第一个满足值的索引号，找不到元素则返回-1 前面往后找
        var arr = ['pink', 'red', 'white', 'yellow'];
        console.log(arr.indexOf('pink'));

        // lastindexOf 后面往前找
        console.log(arr.lastIndexOf('blue'));
    </script>
</head>

<body>

</body>

</html>